#include<stdio.h>
int main()
{
	int k = 0;
	int n = 0;
	scanf("%d %d", &n, &k);
	int count = n + (n - 1) / (k - 1);//count - n = count - 1 / k
	printf("%d", count);
	return 0;
}